from DrissionPage import Chromium

# 连接浏览器并获取浏览器对象
brower = Chromium()
# 获取标签页对象并打开网页
# tab1 = brower.new_tab('https://www.baidu.com')
# tab2 = brower.new_tab('https://www.bing.com')
# tab3 = brower.latest_tab
#
# print(tab1.title)
# print(tab2.title)
# print(tab3.title)
#
# # 关闭最新的标签页
# brower.latest_tab.close()

# 标签页没有selenium所谓的焦点概念，多个标签可以并行操作，所以可以多线程同时打开多个标签页进行操作
from concurrent.futures import ThreadPoolExecutor

def open_tab(brower,url):
    brower.new_tab(url)

chinese_urls = ['https://www.baidu.com',
                'https://www.bing.com',
                'https://www.sogou.com']

with ThreadPoolExecutor(max_workers=3) as executor:
    for url in chinese_urls:
        executor.submit(open_tab,brower, url)







